-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix behaviors of gui.sidePanelWidth: 1
#4583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix behaviors of gui.sidePanelWidth: 1
#4583
Conversation
Previously we were relying on setting just the sideSectionWeight in order to ensure the main panel was fully focused. This can cause a problem if the user had their `gui.sidePanelWidth` set to 1. Such a value make the mainPanelWidth = 0 by default. By just setting the sideSectionWeight, you then communicate to the UI that you want _both_ halves of the screen to have 0 width! No good! This change seems like it won't impact users of more standard `gui.sidePanelWidth` values, so it's just a free win!
Any time that we are on the `currentWindow == "main"` it makes sense for it to be visible, and this will ensure that
gui.sidePanelWidth: 1
The changes make sense to me. I guess there are some more weirdnesses around focusing the main view in half or full screen mode, but I don't use these modes much, and can't be bothered right now to explore this more. 😄 We have fancy tests for this kind of stuff in |
I was unable to test the full flow that caused the crash from the initial bug report inside of window_arrangement_helper_test.go, so I created a full integration test.
Sure, just added! Those tests don't end up exercising the crash point that created this PR, so I also made an integration test for that behavior in particular. I also realized I had inadvertently duplicated the logic of "make the main view full screen", so I added a fixup to simply that logic. |
Looks great. Just one last question about the integration test: I verified that it crashes when I revert the production code changes, but only if I run it with |
Hmmm, I'm unable to reproduce that. If I cherrypick the test out to master, and run it with:
I get the error. I also squashed the 3 commits and reverted them, and then it also failed there |
I investigated a bit more, and found that it depends on the window geometry: if the window is twice as wide as it is tall, the test succeeds; if it is square, it crashes. Playing around with it more, I'm not sure the behavior is always what we want when you are in staging or in patch building mode. I need more time to wrap my head around it, and probably won't get around to it this weekend; but I'd like to hold off merging this until I understand this better. |
Ok, so there are problems because of this code: it runs unconditionally no matter whether we are in half-screen or full-screen mode, and this causes weird behavior, depending on the window geometry. For example, if you select a directory in the files panel that has both staged and unstaged changes, then it will show the main panels even with I think this condition needs to move somehow so that it is only checked when we're not in full or half screen mode, and only if mainSectionWeight is not 1. I don't have enough energy right now to make a concrete suggestion what this could look like. Other observations:
|
We have technically allowed
sidePanelWidth = 1
in the schema for forever. But it seems it never worked! #4582This PR fixes 2 behaviors:
gui.sidePanelWidth
set to 1. Such a value make the mainPanelWidth = 0 by default. By just setting the sideSectionWeight, you then communicate to the UI that you want both halves of the screen to have 0 width! No good! Crash!These changes seem like they won't impact users of more standard
gui.sidePanelWidth
values, so it's just a free win!Fixes #4582
go generate ./...
)